//
//  GameComponent.h
//  GameComponentSystem
//
//  Created by Jeppe Nielsen on 9/24/14.
//  Copyright (c) 2014 Jeppe Nielsen. All rights reserved.
//

#pragma once
#include "GameComponentType.hpp"
#include "TypeDefs.hpp"

class World;
class GameObject;

template<class T>
class GameComponent {
public:
    static int ID;
    static ComponentMask Mask;
    static ComponentMask MaskInverse;
protected:
    virtual void Reset();
private:
    
    int referenceCount;
    int indexInList;

    template<class U>
    friend class GameComponentType;
    
    friend class GameObject;
    friend class World;
};

template<class T>
int GameComponent<T>::ID = GameComponentTypeFactory::GetID<T>();

template<class T>
ComponentMask GameComponent<T>::Mask = (1<<ID);

template<class T>
ComponentMask GameComponent<T>::MaskInverse = ~(1<<ID);

template<class T>
void GameComponent<T>::Reset() {}

#define COMPONENT(Name) \
class Name : public GameComponent<Name> { \
public: \



